package com.rem.controller;

import com.rem.pojo.Dog;
import com.rem.pojo.User;
import com.rem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.server.Session;
import org.springframework.web.bind.annotation.*;


import javax.annotation.processing.Processor;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author remembrance
 * @version 1.0
 * @date 2021/11/11 11:12
 */
@SuppressWarnings("all")
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/user")
    public List<User> selectAllUser(){
        List<User> userList = userService.selectAll();
        return userList;
    }

    @DeleteMapping("/user")
    public String deleteUser(){
        return "删除成功!";
    }

    @GetMapping("/user/{id}")
    public User getUser(@PathVariable("id") Integer id){
        User user = new User();
//        user.setName("remembrance");
//        user.setAge(18);
//        user.setDog(new Dog("keji"));
        return user;
    }
//
    @PostMapping("/user")
    public User addUser(User user){
        return user;
    }

}
